package com.itjiange.duck;

import com.itjiange.callbehavior.CallBehavior;
import com.itjiange.flybehavior.FlyBehavior;
import lombok.Data;

/**
 * 鸭子抽象类
 *
 * @author ItJianGe
 * @data 2024/8/15 10:03
 */
@Data
public abstract class Duck {

    protected FlyBehavior flyBehavior;
    protected CallBehavior callBehavior;

    public abstract void display();

    public void swim() {
        System.out.println("会游泳");
    }

    public void fly() {
        flyBehavior.fly();
    }

    public void call() {
        callBehavior.call();
    }
}
